import { getChannelAPI } from '@/apis/article'
import { useState, useEffect } from 'react'

function useChannel() {
    const [channelList, setChannelList] = useState([])
    useEffect(() => {
        //1.封装函数 在函数体内调用接口
        const getChannelList = async () => {
            const res = await getChannelAPI()
            setChannelList(res.data.channels)
        }
        //2.执行函数
        getChannelList()
    }, [])
    return {
        channelList
    }
}
export { useChannel }

